import { useQuery } from "react-query";
import { useHttp } from ".";
import { useMount } from "../hooks";
import { User } from "../types/user";
import { useAsync } from "../utils/use-async";

// export const useQueryUsers = (param?: Partial<User>) => {
//   const client = useHttp();
//   const { run, ...result } = useAsync<User[]>();
//   useMount(() => {
//     run(client("/users"));
//   });
//   return result;
// };
export const useQueryUsers = (param?: Partial<User>) => {
  const client = useHttp();
  return useQuery(["users"], () => client("/users"));
};
